import request from '@/utils/request';
import { TableListParams } from './data';

export async function queryRule(params?: Object) {
  return request('/api/goods/market', {
    method: 'GET',
    params,
  });
}

export async function removeRule(data: { key: number[] }) {
  return request(`/api/goods/market/${data.key.toString()}`, {
    method: 'DELETE',
    // data,
  });
}

export async function addRule(data: object) {
  return request('/api/goods/market', {
    method: 'POST',
    data,
  });
}

export async function updateRule(id: number, data: TableListParams) {
  return request(`/api/goods/market/${id}`, {
    method: 'PUT',
    data,
  });
}

export async function addMarketGoods(data: { marketId: number, goods: any }) {
  return request(`/api/goods/marketGoods/goods`, {
    method: 'POST',
    data
  });
}

// 商品列表
export async function goodslistRule(params?: Object) {
  return request('/api/goods/list', {
    method: 'GET',
    params,
  });
}


export async function marketGoods(id: number) {
  return request(`/api/goods/market/detail/${id}`, {
    method: 'GET'
  });
}
